Mattermost

Parameters

Configuration

  1. Create a bot account and copy token after creating it 1
  2. Invite team 2
  3. Store token in argocd-notifications-secret Secret and configure Mattermost integration in argocd-notifications-cm ConfigMap
  1. apiVersion: v1
  2. kind: ConfigMap
  3. metadata:
  4. name: <config-map-name>
  5. data:
  6. service.mattermost: |
  7. apiURL: <api-url>
  8. token: $mattermost-token
  1. apiVersion: v1
  2. kind: Secret
  3. metadata:
  4. name: <secret-name>
  5. stringData:
  6. mattermost-token: token
  1. Copy channel id 4

  2. Create subscription for your Mattermost integration

  1. apiVersion: argoproj.io/v1alpha1
  2. kind: Application
  3. metadata:
  4. annotations:
  5. notifications.argoproj.io/subscribe.<trigger-name>.mattermost: <channel-id>

Templates

Mattermost - 图4

You can reuse the template of slack.
Mattermost is compatible with attachments of Slack. See Mattermost Integration Guide.

  1. template.app-deployed: |
  2. message: |
  3. Application {{.app.metadata.name}} is now running new version of deployments manifests.
  4. mattermost:
  5. attachments: |
  6. [{
  7. "title": "{{.app.metadata.name}}",
  8. "title_link": "{{.context.argocdUrl}}/applications/{{.app.metadata.name}}",
  9. "color": "#18be52",
  10. "fields": [{
  11. "title": "Sync Status",
  12. "value": "{{.app.status.sync.status}}",
  13. "short": true
  14. }, {
  15. "title": "Repository",
  16. "value": "{{.app.spec.source.repoURL}}",
  17. "short": true
  18. }]
  19. }]